﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace GameBase
{
    public class OneTimeSprite : My2DSprite
    {
        private float _totalTime = 0;

        public OneTimeSprite(string imgStr, int nTexture, Vector2 pos, float scale, float delay)
            : base(imgStr, nTexture, pos, scale, delay)
        {
        }

        public OneTimeSprite(Texture2D texture, int nTexture, Vector2 pos, float scale, float delay)
            : base(texture, nTexture, pos, scale, delay)
        {
        }

        public override void update(GameTime gameTime)
        {
            _totalTime += gameTime.ElapsedGameTime.Milliseconds;
            int delta = (int)(_totalTime / NomalDelay);

            if (delta < nTexture - 1)
                iTexture = (delta) % nTexture;
            else
                iTexture = nTexture - 1;
        }
    }
}
